
package com.yxinsur.imc.business.enums;

import com.yxinsur.imc.common.utils.StringUtils;
import lombok.Getter;

@Getter
public enum PolittcalStatus {

    /**
     * 群众
     */
    A("A|群众", "群众"),

    /**
     * 团员
     */
    B("B|团员", "团员"),

    /**
     * 党员
     */
    C("C|党员", "党员"),

    /**
     * 其他
     */
    H("H|其他", "其他");

    private String keyNames;

    private String keyName;

    private PolittcalStatus(String keyNames, String keyName) {
        this.keyNames = keyNames;
        this.keyName = keyName;
    }

    public String getKeyNames() {
        return keyNames;
    }

    public String getKeyName() {
        return keyName;
    }

    public static String getValueByKeyName(String keyName) {
        String keyValue = null;
        if (StringUtils.isNotBlank(keyName)) {
            for (PapersType c : PapersType.values()) {
                if (c.getKeyNames().contains(keyName)) {
                    keyValue = c.name();
                    break;
                }
            }
        }
        return keyValue;
    }

    public static String getKeyNameByValue(String value) {
        String keyValue = null;
        if (StringUtils.isNotBlank(value)) {
            for (PapersType c : PapersType.values()) {
                if (c.getKeyNames().contains(value)) {
                    keyValue = c.getKeyName();
                }
            }
        }
        return keyValue;
    }
}
